Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pf: fix build on kernels without "options INET" #1511

Closed
wants to merge 1 commit into from

Conversation

llfw
Copy link
Contributor

@llfw llfw commented Nov 3, 2024

  • IN_LOOPBACK() cannot be used without INET, because it references a VNET symbol vnet_entry_in_loopback_mask.

  • ip_fillid() is not available without INET. since this codepath is only entered in the AF_INET case, guard it with #ifnet INET.

Fixes: 27f54be ("pf: merge pf_test() and pf_test6()")
Fixes: 4f9e688 ("pf: merge pf_scrub_ip() and pf_scrub_ip6()")

cc @kprovost

- IN_LOOPBACK() cannot be used without INET, because it references a
  VNET symbol vnet_entry_in_loopback_mask.

- ip_fillid() is not available without INET.  since this codepath is
  only entered in the AF_INET case, guard it with #ifnet INET.

Fixes: 27f54be ("pf: merge pf_test() and pf_test6()")
Fixes: 4f9e688 ("pf: merge pf_scrub_ip() and pf_scrub_ip6()")
case AF_INET:
return IN_LOOPBACK(ntohl(addr->v4.s_addr));
#endif
case AF_INET6:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this case also need an #ifdef INET6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because IN6_IS_ADDR_LOOPBACK() doesn't depend on any symbols.

IN_LOOPBACK() is strange because of the sysctl net.inet.ip.loopback_prefixlen which is why it references a VNET symbol.

this is not the first time i've fixed this exact same bug -- i'm wondering if we should just remove this 'feature' entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, in efe5885, implementing draft-schoen-intarea-unicast-127-06. Thank you for the info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wasn't aware of that I-D, but i accept this as a reason not to remove the feature :-)

@kprovost
Copy link
Contributor

kprovost commented Nov 3, 2024

What kernel config fails to build? As far as I know make universe passes and LINT-NOINET builds, so I’m a little confused about this.

@llfw
Copy link
Contributor Author

llfw commented Nov 3, 2024

kernel config:

the build is fine actually, but the module cannot load:

Oct 18 16:34:00 amaranth syslogd: kernel boot file is /boot/kernel.LFV6/kernel
Oct 18 16:34:00 amaranth kernel: ---<<BOOT>>---
Oct 18 16:34:00 amaranth kernel: Copyright (c) 1992-2024 The FreeBSD Project.
Oct 18 16:34:00 amaranth kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
Oct 18 16:34:00 amaranth kernel:        The Regents of the University of California. All rights reserved.
Oct 18 16:34:00 amaranth kernel: FreeBSD is a registered trademark of The FreeBSD Foundation.
Oct 18 16:34:00 amaranth kernel: FreeBSD 15.0-CURRENT #0 lf/main-n269062-8b0d50ee49b: Fri Oct 18 07:25:38 BST 2024
Oct 18 16:34:00 amaranth kernel:     [email protected]:/data/build/obj/freebsd/data/build/src/freebsd/lf/main/amd64.amd64/sys/LFV6 amd64
Oct 18 16:34:00 amaranth kernel: FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
Oct 18 16:34:00 amaranth kernel: VT: init without driver.
Oct 18 16:34:00 amaranth kernel: XEN: Hypervisor version 4.14 detected.
Oct 18 16:34:00 amaranth kernel: link_elf_obj: symbol vnet_entry_in_loopback_mask undefined
Oct 18 16:34:00 amaranth kernel: KLD file pf.ko - could not finalize loading
Oct 18 16:34:00 amaranth kernel: CPU: Intel(R) Xeon(R) W-1290P CPU @ 3.70GHz (3696.19-MHz K8-class CPU)

@jlduran jlduran added the merged label Nov 4, 2024
@jlduran
Copy link
Member

jlduran commented Nov 4, 2024

Landed as 9ca3286.

@jlduran jlduran closed this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants